#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>

void left_hand_string(char* p,int len,int n)
{
	int left = 0;
	int right = len - 1;
	char temp;
	for (int i = 0; i < n; i++)
	{
		temp = *p;
		for (int j = 1; j < len; j++)
		{
			*(p + j - 1) = *(p + j);
		}
		*(p + len - 1) = temp;
	}
}
int main()
{
	int n = 0;
	char c[50];
	gets_s(c);
	scanf("%d", &n);
	int len = strlen(c);
	left_hand_string(c,len,n);
	printf("%s", c);
	return 0;
}